<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-01-12 10:52:50
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-05-10 13:55:39
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\order-management\\components\\receipts-audit\\receipts-audit.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<!-- 搜索表单 -->
<!-- <page-header-wrapper [title]="''"> </page-header-wrapper>
<nz-card>
  <div nz-row nzGutter="8">
    <div nz-col [nzSpan]="_$expand ? 24 : 18">
      <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
    </div>
    <div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
      <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="search()" acl
        [acl-ability]="['ORDER-RECEIPTS-search']">查询</button>
      <button nz-button nzType="primary" [disabled]="false" (click)="exprot()">导出</button>
      <button nz-button [disabled]="false" (click)="resetSF()">重置</button>
      <button nz-button nzType="link" (click)="expandToggle()">
        {{ !_$expand ? '展开' : '收起' }}
        <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
      </button>
    </div>
  </div>
</nz-card> -->

<nz-card class="table-box">
  <div class="tab_header">
    <label class="page_title"> <label class="driver">|</label> 单据审核</label>
    <nz-tabset (nzSelectedIndexChange)="selectChange($event)" [nzTabBarExtraContent]="extraTemplate">
      <nz-tab [nzTitle]="'全部(' + tabs?.totalCount + ')'"></nz-tab>
      <nz-tab [nzTitle]="'待审核(' + tabs?.receivedQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'已审核(' + tabs?.stayQuantity + ')'"></nz-tab>
    </nz-tabset>
  </div>

  <div>
    <st
      #st
      [bordered]="true"
      [scroll]="{ x: '2000px', y: scrollY }"
      [data]="service.$api_get_billExamine_page"
      [columns]="columns"
      [req]="{ process: beforeReq }"
      [res]="{ reName: { list: 'data.records', total: 'data.total' }, process: afterRes }"
      [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
      [loading]="false"
    >
      <ng-template st-row="freightPrice" let-item let-index="index">
        {{ item.freightPrice | currency }}
      </ng-template>
      <ng-template st-row="loadingLadingBillFilePath" let-item let-index="index">
        <div class="imgBox">
          <div *ngIf="item.loadingLadingBillFilePath">
            <app-imagelist style="width: 40px" [imgList]="[item.loadingLadingBillFilePath]"> </app-imagelist>
          </div>
          <div *ngIf="item.loadingPeopleVehiclesGoodsFilePath">
            <app-imagelist style="width: 40px" [imgList]="[item.loadingPeopleVehiclesGoodsFilePath]"> </app-imagelist>
          </div>
        </div>
      </ng-template>
      <ng-template st-row="unloadingLadingBillFilePath" let-item let-index="index">
        <div class="imgBox">
          <div *ngIf="item.unloadingLadingBillFilePath">
            <app-imagelist style="width: 40px" [imgList]="[item.unloadingLadingBillFilePath]"> </app-imagelist>
          </div>
          <div *ngIf="item.unloadingPeopleVehiclesGoodsFilePath">
            <app-imagelist style="width: 40px" [imgList]="[item.unloadingPeopleVehiclesGoodsFilePath]"> </app-imagelist>
          </div>
        </div>
      </ng-template>
      <ng-template st-row="loadingTime" let-item let-index="index">
        <div *ngIf="item?.loadingTime">装 | {{ item?.loadingTime }}</div>
        <div *ngIf="item?.unloadingTime">卸 | {{ item?.unloadingTime }}</div>
      </ng-template>
      <ng-template st-row="driverName" let-item let-index="index">
        <div>
          <a (click)="routerTo('/usercenter/driver/detail/' + item.driverId)">
            {{ item?.driverName }}{{ item?.driverPhone ? '/' + item?.driverPhone : '' }}
          </a>
          <a (click)="routerTo('/vehicle/list/detail/' + item.carId)">
            {{ item?.carNo ? '/' + item?.carNo : '' }}
          </a>
        </div>
      </ng-template>
      <ng-template st-row="payeeName" let-item let-index="index">
        <div *ngIf="item.payeeName !== item.driverName">
          <a (click)="routerTo('/usercenter/driver/captain/detail/' + item.payeeId)">
            {{ item?.payeeName }}{{ item?.payeePhone ? '/' + item?.payeePhone : '' }}
          </a>
        </div>
      </ng-template>
      <ng-template st-row="billCode" let-item let-index="index">
        <!-- <div>{{ item.billCode }}</div> -->
        <a *ngIf="item.resourceType == '1'" [routerLink]="'/order-management/vehicle/vehicle-detail/' + item.id">{{ item.billCode }}</a>
        <a *ngIf="item.resourceType == '2'" [routerLink]="'/order-management/bulk/bulk-detail/' + item.id">{{ item.billCode }}</a>
        <a *ngIf="item.resourceType == '3'" [routerLink]="'/order-management/vehicle/vehicle-detail/' + item.id">{{ item.billCode }}</a>
        <div>
          <span>{{ item?.billStatusLabel }}</span>
        </div>
        <div>
          <span>{{ item?.billSourceLabel }}{{ item?.billSource == 1 ? item?.serviceTypeLabel : '' }} </span>
        </div>
      </ng-template>
      <ng-template st-row="goodsName" let-item let-index="index">
        <div>{{ item?.goodsName }}</div>
        <div>
          <span>{{ item?.weight ? item?.weight + '吨/' : '' }}</span>
          <span>{{ item?.volume ? item?.volume + '方/' : '' }}</span>
          <span>{{ item?.goodsNumber ? item?.goodsNumber + '件' : '' }}</span>
        </div>
      </ng-template>
      <ng-template st-row="mybidDetailInfo" let-item let-index="index">
        <div *ngIf="item.mybidDetailInfo.length > 0">
          <p *ngFor="let data of item.mybidDetailInfo">
            {{ data.expenseName }}：{{ data.price | currency }}
            <span *ngIf="data.paymentStatusLabel" style="color: #f59a63">{{ data.paymentStatusLabel }}</span>
          </p>
        </div>
      </ng-template>
    </st>
  </div>
</nz-card>

<ng-template #extraTemplate>
  <div>
    <button nz-button nzDanger [nzLoading]="service.http.loading" (click)="openDrawer()" acl [acl-ability]="['ORDER-RECEIPTS-search']"
      >筛选</button
    >
    <button nz-button nzDanger [disabled]="false" (click)="exprot()" acl [acl-ability]="['ORDER-RECEIPTS-export']">导出</button>
    <button nz-button nz-dropdown [nzDropdownMenu]="menu" nzPlacement="bottomLeft">
      更多<i nz-icon nzType="down" nzTheme="outline"></i
    ></button>
    <nz-dropdown-menu #menu="nzDropdownMenu">
      <ul nz-menu>
        <li nz-menu-item (click)="sign('1')" acl [acl-ability]="['ORDER-RECEIPTS-billAuditPassBatch']"> 批量通过 </li>
        <li nz-menu-item (click)="sign1('1')" acl [acl-ability]="['ORDER-RECEIPTS- electronicBilling']"> 批量生成电子单据 </li>
      </ul>
    </nz-dropdown-menu>
  </div>
</ng-template>
